LearningStoreJob.PerformQuery Method

Perform a query

Parent Type: LearningStoreJob

Namespace: Microsoft.LearningComponents.Storage

Assembly: Microsoft.LearningComponents.Storage.dll

Syntax
C#

public void PerformQuery (
LearningStoreQuery query

)

Parameters

query

The query to be performed

Exceptions
Exception type Condition
ArgumentNullException

query is a null reference.

InvalidOperationException

query was not created from this LearningStore, or at least one output column was not specified in the query.

Remarks

Steps required to perform a query:

The System.Data.DataTable returned in the result contains one column for each output column added to the LearningStoreQuery using LearningStoreQuery.AddColumn. See LearningStoreQuery.AddCondition for a list of the possible types that are returned.

See the LearningStoreQuery documentation for more information about queries.

Example

The following code performs a query to retrieve the names of all the users:

C#
// Create the query
LearningStoreQuery query = store.CreateQuery("UserItem");
 
// Add output columns to the query
query.AddColumn("Name");
 
// Create a job and add the "perform query" operation
LearningStoreJob job = store.CreateJob();
job.PerformQuery(query);
 
// Execute the job
DataTable result = job.Execute<DataTable>();
After this code is executed, result contains a DataTable with one column named "Name." The DataTable contains one row for every user.